﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MoneyBooker {
	public partial class MainWindow : Form {

		CsvParser mParser = null;

		public MainWindow() {
			InitializeComponent();
			this.StartPosition = FormStartPosition.CenterScreen;
			mParser = new CsvParser(this);
		}

		public void setProgress(int progress) {
			mProgress.Value = progress;
		}

		private void mLoad_Click(object sender, EventArgs e) {
			OpenFileDialog dialog = new OpenFileDialog();
			dialog.ShowDialog();

			int totalLines,
				newLines;

			mParser.parseFile(dialog.FileName, out totalLines, out newLines);
			if (MessageBox.Show( "Laden voltooid.\nTotaal: " + totalLines.ToString() + "\nNieuw: " + 
				newLines.ToString() + "\nStart parsen van data?", "Voltooid", 
				MessageBoxButtons.YesNo ) == DialogResult.Yes) {
					mParser.parseTransactions();
			}
		}

		private void mPrint_Click(object sender, EventArgs e) {
			MessageBox.Show("Not Implemented");
		}

		private void mClose_Click(object sender, EventArgs e) {
			this.Close();
		}

		private void MainWindow_Load(object sender, EventArgs e) {
			Image logoKbc = new Bitmap("Igo_kbc.gif");
			Image logoArgenta = new Bitmap("logo_tcm55-2188.gif");

			PictureBox picBox = new PictureBox();
			picBox.Image = logoKbc;
			picBox.Size = logoKbc.Size;
			picBox.Left = this.Width / 2 - picBox.Width / 2;
			picBox.Top = this.Height / 2 - picBox.Height / 2;

			this.Controls.Add(picBox);
		}
	}
}
